Mark positional-only parameters in the IcePy stub and docstrings - #6607
Merged
Conversation
The IcePy stub declared ordinary, keyword-capable parameters for almost every function, but the C functions behind them are registered METH_VARARGS (or METH_O) and parse with PyArg_ParseTuple, so they accept positional arguments only. Type checkers therefore accepted calls such as connection.setAdapter(adapter=None) that raise TypeError at runtime. The constructors are worse: their tp_init ignores the keyword dict, so IcePy.Properties(args=[...]) silently dropped the argument. Add a '/' marker to every affected declaration in the stub, and add the same marker to the signature line of the corresponding IcePy docstrings, which must match the stub (checkIcePyStub.py) and feed the Sphinx API reference. ice_invoke and ice_invokeAsync are registered with METH_KEYWORDS and genuinely accept keyword arguments; they are unchanged. Fixes #6442
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns IcePy type stubs and documentation with the extension’s positional-only runtime APIs.
Changes:
- Marks affected parameters positional-only in the IcePy stub.
- Updates corresponding C-extension docstrings.
- Adds the #6442 changelog fragment.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
python/python/IcePy-stubs/__init__.pyi |
Corrects positional-only signatures. |
python/modules/IcePy/Proxy.cpp |
Updates proxy method signatures. |
python/modules/IcePy/PropertiesAdmin.cpp |
Updates properties-admin signatures. |
python/modules/IcePy/Properties.cpp |
Updates properties signatures. |
python/modules/IcePy/Operation.cpp |
Updates operation signatures. |
python/modules/IcePy/ObjectAdapter.cpp |
Updates adapter signatures. |
python/modules/IcePy/Logger.cpp |
Updates logger signatures. |
python/modules/IcePy/Init.cpp |
Updates module function signatures. |
python/modules/IcePy/ImplicitContext.cpp |
Updates context signatures. |
python/modules/IcePy/Connection.cpp |
Updates connection signatures. |
python/modules/IcePy/Communicator.cpp |
Updates communicator signatures. |
changelog.d/python/6442.md |
Documents the correction. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
externl
approved these changes
Aug 14, 2026
externl
left a comment
Member
There was a problem hiding this comment.
Looks good.
- 24 rich-comparison dunders still declare a named parameter —
Connection(:313-319),Endpoint(:372-377),ImplicitContext(:463-468),ObjectPrx(:600-606). They'retp_richcompareslot wrappers, so__eq__(other=1)raisesTypeError: takes no keyword argumentsexactly like the methods this PR fixes. Cosmetic, since wideningobject.__eq__is legal against typeshed — butisDunderincheckIcePyStub.pyexempts them, so nothing will catch the drift later. - Heads-up on merge order with #6609: it rewrites the same module-level function block (
createProperties,stringToIdentity,identityToString,setProcessLogger,loadSlice,compileSlice) from a base without the/, so a textual conflict is certain. If that side wins the resolution, the stub loses six markers while the C docstrings keep theirs, and the checker #6609 adds fails CI with six signature mismatches.
bernardnormier
left a comment
Member
There was a problem hiding this comment.
The debug on ubuntu-24.04 failure is in DataStorm/events — unrelated to this PR.
bernardnormier
approved these changes
Aug 14, 2026
Co-authored-by: Bernard Normier <bernard@zeroc.com>
The rich comparisons on Connection, Endpoint, ImplicitContext, and ObjectPrx are tp_richcompare slot wrappers, so __eq__(other=1) raises TypeError just like the METH_VARARGS methods. This also matches typeshed, which declares object.__eq__ positional-only.
Member
Author
|
🤖 Claude: @externl Both points addressed:
|
externl
reviewed
Aug 14, 2026
Member
There was a problem hiding this comment.
Since this is all for IcePy I don't think it deserves a changelog entry.
externl
pushed a commit
that referenced
this pull request
Aug 20, 2026
(cherry picked from commit d7e9cf5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The IcePy stub declared ordinary, keyword-capable parameters for almost every function, but the C functions behind them are registered
METH_VARARGS(orMETH_O) and parse withPyArg_ParseTuple, so they accept positional arguments only. Type checkers therefore accepted calls such asconnection.setAdapter(adapter=None)that raiseTypeErrorat runtime. The constructors are worse: theirtp_initignores the keyword dict, soIcePy.Properties(args=[...])silently dropped the argument.This PR adds a
/marker to every affected declaration in the stub, and the same marker to the signature line of the corresponding IcePy docstrings, which must match the stub (checkIcePyStub.py) and feed the Sphinx API reference.ice_invokeandice_invokeAsyncare registered withMETH_KEYWORDSand genuinely accept keyword arguments; they are unchanged.Fixes #6442